package com.hxrk.easyface;

/**
 * Created by Smx on 2018/3/3.
 */

public class EasyFace {
    public EasyFace() {
    }

    // Used to load the 'EasyFace' library on application startup.
    static {
        System.loadLibrary("opencv_java3");
        System.loadLibrary("EasyFace");
    }

    //单例
    private static class SdkHodler {
        static EasyFace instance = new EasyFace();
    }

    public static EasyFace getInstance() {
        return SdkHodler.instance;
    }

    //回调到各个线程
    public interface OnSubFaceListener {
        public void onFaceNum(int faceNum);                                                      //当前图像中的人脸数量，实时返回
        public void onFaceNew(long listID, float[] faceFea);                                     //新的人脸，可以弹窗保存
        public void onFaceOk(String faceID);                                                        //识别成功，返回人脸ID
        public void ServerConInfo(boolean tip);                                                              //服务器连接信息

    }


    /**
     * A native method that is implemented by the 'EasyFace' native library,
     * which is packaged with this application.
     */
    public native void nativeInitFaceModePath(String vFaceModelPath, String vIP,int vPort,String vdriverID, int vminsize, OnSubFaceListener l);

    public native void nativeInitCamera(int w, int h);

    //    public native void nativeProcessFrame(long matAddrGr, long matAddrRgba);
    public native void nativeProcessFrame(long matAddrRgba, int w, int h);

    public native long nativeDrawFrame(long AddrRgba, int w, int h);

    public native void nativeInitFaceInfo(long faceID, String faceName, float[] faceFea);       //从数据库中读取写入对比队列

    public native float[] nativeInitFaceInfoImg(String imgPath);                                 //从图片中识别人脸写入对比队列

    public native void nativeChangeFaceInfo(long listID, long faceID, String faceName);         //将保存的后的姓名更新到对比队列

    public native void nativeFaceecognitionNow(String vdriverID, int isStart);//立即识别

    public native void nativeGetFaceNumber(long addrBGR, int w, int h, int len);

    public native long getNativeProcessFrame();//获取传入图像函数指针

    public native long getNativeDrawFrame();//获取处理绘制图像人脸的函数指针

    public native long getNativeGetFaceNumber();//获取处理检测人脸数图像函数指针

    public native void stopEasyFaceThread();//停止结束人脸识别线程
//    private native void nativeInit();
//
//    private native void nativeResize(int w, int h);
//
//    private native void nativeRender();

}
